/* ----------------------------------------------------------------------------------------------------------------
 * VisibleCore
 * ----------------------------------------------------------------------------------------------------------------
 */
package pure.engine.core
{
	import flash.filters.BitmapFilter;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	
	import pure.utils.DesN;
	import pure.debug.ErrorKai;
	import pure.engine.system.ns_despair;
	
	use namespace ns_despair;
	
	
	/**
	 * 
	 * 
	 * <Hint> 
	 * 
	 * throw new ErrorKai(this, 'constructior', 'This is an Abstract Class !!');
	 * 
	 * @author ＃Pure
	 */
public class VisibleCore implements IVisible
{

	
	
	//======================
	// Member
	//======================
	
	
	ns_despair var m_x:Number;  // 坐标X
	
	ns_despair var m_y:Number;  // 坐标Y
	
	ns_despair var m_name:String;  // 名称

	ns_despair var m_range:Number;  // 面积
		
	ns_despair var m_angle:Number = 0;  // 弧度
	
	ns_despair var m_visible:Boolean = true;  // 是否可见
	
	ns_despair var m_filterList:Array;  // 滤镜列表
	
	ns_despair var m_numFilter:int;  // 滤镜数目
	
	ns_despair var m_realRect:Rectangle;  // 真实矩形（碰撞检测，会产生形变或透明度变化的渲染器通常不能使用）

	ns_despair var m_rangeDirty:Boolean;  // 面积变化
	
	
	//======================
	// Cached Object
	//======================
	
	ns_despair static var cachedPoint:Point = new Point();
	
	ns_despair static var cachedZeroPoint:Point = new Point();

	
	
	
	
	
	//======================
	// Property
	//======================
	
	
	// 是否可见
	public function get visible():Boolean 
	{ 
		return m_visible;
	}
	
	public function set visible(b:Boolean):void
	{ 
		m_visible = b; 
	}
	
	
	// 弧度范围 [ 0 ~ PI ~ -PI ~ 0 ]
	public function get angle():Number 
	{ 
		return m_angle; 
	}
	
	public function set angle(v:Number):void 
	{ 
		// Override !!
	}
	
	
	// 角度范围 [ 0 ~ 360 ]
	public function get rotation():Number 
	{
		var n:Number;
		
		n = m_angle * DesN.ONE_EIGHTY_OVER_PI;
		return n < 0 ? n + 360 : n;
	}
	
	public function set rotation(v:Number):void 
	{ 
		this.angle = v * DesN.PI_OVER_ONE_EIGHTY; 
	}
	
	
	
	
	
	//======================
	// Filter
	//======================
	
	
	public function addFilter(F:BitmapFilter):void
	{
		if (!m_filterList)
		{
			m_filterList = [];
		}
		m_filterList.push(F);
		m_numFilter++;
	}
	
	
	public function clearFilter():void
	{
		m_filterList.length = m_numFilter = 0;
	}
	
	
	

	/* ----------------------------------------------------------------------------------------------------------------
	 * ★★★★★★★★★★★★★★★★★★★★★  private  ★★★★★★★★★★★★★★★★★★★★★
	 * ----------------------------------------------------------------------------------------------------------------
	 */
	
	
	
	ns_despair function destroy():void
	{
		m_filterList = null;
	}
	
	
	
	
}
}